package com.xiaoxing.paimai.mvp.ui.entity;

import android.content.Context;


import com.xiaoxing.paimai.mvp.ui.database.SQLiteDBService;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class InfoInventory {
	private String _inid;
	private String _material;
	private String _spname;
	private String _nums;
	private String _unit;
	private String _unitPrice;
	private String _mmodel;
	private String _mbm;
	private String _spid;
	private String _sname;
	private String _Row;
	private String _sid;

	private SQLiteDBService sqliteDBservice;

	public InfoInventory() {

	}

	public InfoInventory(Context context) {
		sqliteDBservice = new SQLiteDBService(context);
	}

	// 将JSON对象转化为list
	public List<InfoInventory> getListFromJSON(String JsonStr) {
		List<InfoInventory> clist = new ArrayList<InfoInventory>();

		try {

			JSONArray jay = new JSONArray(JsonStr);// 将字符串转化为JSON数组

			for (int i = 0; i < jay.length(); i++) {
				JSONObject temp = (JSONObject) jay.get(i);

				InfoInventory n = new InfoInventory();

				n.set_material(temp.getString("material"));
				n.set_unitPrice(temp.getString("unitPrice"));
				n.set_unit(temp.getString("unit"));
				n.set_mbm(temp.getString("mbm"));
				n.set_mmodel(temp.getString("mmodel"));
				n.set_spname(temp.getString("spname"));
				n.set_spid(temp.getString("spid"));
				n.set_sname(temp.getString("sname"));
				n.set_nums(temp.getString("nums"));
				n.set_inid(temp.getString("inid"));
				n.set_Row(temp.getString("Row"));
				n.set_sid(temp.getString("sid"));
				clist.add(n);

			}

		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return clist;

	}

	
	public String get_sid() {
		return _sid;
	}

	public void set_sid(String _sid) {
		this._sid = _sid;
	}

	public String get_Row() {
		return _Row;
	}

	public void set_Row(String _Row) {
		this._Row = _Row;
	}

	public String get_inid() {
		return _inid;
	}

	public void set_inid(String _inid) {
		this._inid = _inid;
	}

	public String get_material() {
		return _material;
	}

	public void set_material(String _material) {
		this._material = _material;
	}

	public String get_spname() {
		return _spname;
	}

	public void set_spname(String _spname) {
		this._spname = _spname;
	}

	public String get_nums() {
		return _nums;
	}

	public void set_nums(String _nums) {
		this._nums = _nums;
	}

	public String get_unit() {
		return _unit;
	}

	public void set_unit(String _unit) {
		this._unit = _unit;
	}

	public String get_unitPrice() {
		return _unitPrice;
	}

	public void set_unitPrice(String _unitPrice) {
		this._unitPrice = _unitPrice;
	}

	public String get_mmodel() {
		return _mmodel;
	}

	public void set_mmodel(String _mmodel) {
		this._mmodel = _mmodel;
	}

	public String get_mbm() {
		return _mbm;
	}

	public void set_mbm(String _mbm) {
		this._mbm = _mbm;
	}

	public String get_spid() {
		return _spid;
	}

	public void set_spid(String _spid) {
		this._spid = _spid;
	}

	public String get_sname() {
		return _sname;
	}

	public void set_sname(String _sname) {
		this._sname = _sname;
	}

}
